#ifndef __TIMER2_H__
#define __TIMER2_H__

#include "Timer_config.h"

#if USE_TIMER2

#include "gd32f4xx.h"
#include "systick.h"


void Timer2_init();
void Timer2_config(uint32_t prescaler, uint32_t period);

#if TIMER2_FUNC == TIMER_FUNC_OUTPUT
#if USE_TIMER2_CH0
void Timer2_ch0_update(float duty);
#endif

#if USE_TIMER2_CH1
void Timer2_ch1_update(float duty);
#endif

#if USE_TIMER2_CH2
void Timer2_ch2_update(float duty);
#endif

#if USE_TIMER2_CH3
void Timer2_ch3_update(float duty);
#endif

#elif TIMER2_FUNC == TIMER_FUNC_INPUT
short Timer2_input_read();
#endif

#endif

#endif